package net.cellkyborg.server;
public class vars {
		
	static int maxVarInt;
	static int maxVarStr;
	
	static int currVarInt;
	static int currVarStr;
	
	static String [] nameVarInt;
	static String [] nameVarStr;
	
	static int [] varInt;
	static String [] varStr;
	
	public vars() {
		maxVarInt = 50;
		maxVarStr = 10;
	
		currVarInt = 0;
		currVarStr = 0;
	
		nameVarInt = new String [maxVarInt];
		nameVarStr = new String [maxVarStr];
	
		varInt = new int [maxVarInt];
		varStr = new String [maxVarStr];
	}
	
	public static int getVarInt(String varName) {
		for (int i = 0;i<currVarInt;i++) {
			if (varName.equals(nameVarInt[i])) return varInt[i];
		}
		return 0;
	}
	public static String getVarStr(String varName) {
		for (int i = 0;i<currVarStr;i++) {
			if (varName.equals(nameVarStr[i])) return varStr[i];
		}
		return null;
	}
	
	public static void setVarInt(String varName,int value) {
		boolean done = false;
		for (int i = 0;i<currVarInt;i++) {
			if (varName.equals(nameVarInt[i])) {
				varInt[i]=value;
				done = true;
			}
		}
		if (!done) {
			nameVarInt[currVarInt]=varName;
			varInt[currVarInt]=value;
			currVarInt++;
		}
	}
	public static void setVarStr(String varName,String value) {
		boolean done = false;
		for (int i = 0;i<currVarStr;i++) {
			if (varName.equals(nameVarStr[i])) {
				varStr[i]=value;
				done = true;
			}
		}
		if (!done) {
			nameVarStr[currVarStr]=varName;
			varStr[currVarStr]=value;
			currVarStr++;
		}
	}

}